<template>
    <div class="header">
      <slot></slot>
      <i class="iconfont icon-fanhui" v-if="back" @click="goBack"></i>
    </div>
</template>

<script>
    export default {
        props:{
          back:{
            type:Boolean,
            default:false
          }
        },
        data() {
            return {
                msg: 'Welcome to Your Vue.js App'
            }
        },
      methods:{
          goBack(){
            //返回
            this.$router.go(-1);
          }
      }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
  .header{
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    background: #afd9ee;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-weight: bold;
    i{
      position: absolute;
      left: 10px;
      font-size: 20px;
    }
  }
</style>
